import { defineConfig } from 'eslint/config'
import eslint from '@eslint/js'
import globals from 'globals'
import tseslint from 'typescript-eslint'
import eslintConfigPrettier from 'eslint-config-prettier'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'

export default defineConfig([
  // JS 基础规则
  eslint.configs.recommended,
  // TS 支持
  tseslint.configs.recommended,
  // Prettier 关闭与格式化冲突的规则
  eslintConfigPrettier,
  // Prettier 插件
  eslintPluginPrettierRecommended,
  {
    files: ['**/*.js', '**/*.ts'],
    languageOptions: {
      globals: { ...globals.browser, ...globals.node },
    },
    rules: {
      'no-unused-vars': 'off', // 用 TS 检查
    },
  },
])
